#include "observer/event.h"

#include <iostream>
#include <string>

int main(void) {
    observer::Event<> event_A;

    auto handler_id = event_A.Connect([](){
        std::cout << "A triggered" << std::endl;
    });

    event_A.NotifyObservers();  // "A triggered"

    observer::Event<const std::string&, int> event_B;

    observer::Observer ob = event_B.CreateObserver([](const std::string& name, int age){
        std::cout << name << "-" << age << std::endl;
    });

    event_B.NotifyObservers("jack", 12);    // jack-12

    ob.observer(event_A, [](){
        std::cout << "from B to A" << std::endl;
    });

    event_A.NotifyObservers();
    event_B.NotifyObservers("rose", 13);    // none

    return 0;
}